home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume12 / xxgdb / patch1 next >
Encoding:
Internet Message Format  |  1991-05-02  |  60.1 KB

  1. Path: uunet!olivea!oliveb!veritas!amdcad!sun!exodus!tce.com
  2. From: pierre@tce.com (Pierre Willard)
  3. Newsgroups: comp.sources.x
  4. Subject: v12i078: xxgdb - X front end for gdb, Patch1, Part01/01
  5. Message-ID: <12785@exodus.Eng.Sun.COM>
  6. Date: 3 May 91 06:47:19 GMT
  7. References: <csx-12i078:xxgdb@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 2276
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: pierre@tce.com (Pierre Willard)
  13. Posting-number: Volume 12, Issue 78
  14. Archive-name: xxgdb/patch1
  15. Patch-To: xxgdb: Volume 11, Issue 42-55
  16.  
  17.  
  18.     XXGDB version 1.03 ( X window interface to the GDB debugger )
  19.     -------------------------------------------------------------
  20.  
  21. A little while ago (January 91) I posted the complete source files
  22. for xxgdb version 1.01.
  23.  
  24. Please find in the following the differences from version
  25. 1.01 to 1.03.
  26.  
  27. Please post this complete message to comp.sources.x
  28.  
  29.  
  30. NEW FEATURES OF VERSION 1.03  :
  31.  
  32.     Add source files selection in file button.
  33.     Special test for core file in file button.
  34.     Fix bug includeDir resource.
  35.     Fix bug source file directories.
  36.     Add patches for SUN-OS3.
  37.     Add strstr function in gdb_parser.c (with #ifdef NEED_STRSTR)
  38.     Remove bad test for MIPS and BSD in case of GDB.
  39.     Miscellaneous patches for lint.
  40.     Port to SYSV + SCO +SYSV32.
  41.     Fix bug up/down/frame when arguments are on several lines.
  42.     Fix bug in UpdateMessageWindow when arguments are too long.
  43.     Fix bug define commands in .gdbinit or source files
  44.     Add db_name and db_prompt option (GWC)
  45.     and miscellaneous bugs.
  46.  
  47. TO PATCH XXGDB FROM VERSION 1.01 TO VERSION 1.03 :
  48.  
  49.     cd <original xxgdb 1.01 source directory>
  50.     chmod +rw *
  51.     patch < <patch_file>
  52.     
  53. THE FOLLOWING IS THE PATCH FILE FOR XXGDB 1.03 FROM XXGDB 1.01 :
  54.  
  55. diff -rc2 v1.01/Imakefile v1.03/Imakefile
  56. *** v1.01/Imakefile    Tue Jan 15 11:18:58 1991
  57. --- v1.03/Imakefile    Tue Apr  2 09:33:13 1991
  58. ***************
  59. *** 8,14 ****
  60.   #endif
  61.   
  62. ! #if defined(SunArchitecture) && OSMajorVersion >= 4
  63. !         DEFINES = -DSUNOS4 $(DEFGDB)
  64.   #endif
  65.   
  66.   #ifdef UltrixArchitecture
  67. --- 8,18 ----
  68.   #endif
  69.   
  70. ! #if defined(SunArchitecture)
  71. ! #if OSMajorVersion >= 4
  72. !     DEFINES = -DSUNOS4 $(DEFGDB)
  73. ! #else
  74. !     DEFINES = -DOLDSUNOS -DNEED_STRSTR $(DEFGDB)
  75.   #endif
  76. + #endif
  77.   
  78.   #ifdef UltrixArchitecture
  79. ***************
  80. *** 20,23 ****
  81. --- 24,30 ----
  82.   #endif
  83.   
  84. + mallocc = #malloc.c
  85. + malloco = #malloc.o
  86.           DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  87.   LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  88. ***************
  89. *** 25,33 ****
  90.              SRCS = calldbx.c command.c dbx.c dialog.c datadpy.c filemenu.c \
  91.             handler.c parser.c regex.c signs.c signals.c source.c \
  92. !           utils.c windows.c xdbx.c
  93.   
  94.              OBJS = calldbx.o command.o dbx.o dialog.o datadpy.o filemenu.o \
  95.             handler.o parser.o regex.o signs.o signals.o source.o \
  96. !           utils.o windows.o xdbx.o
  97.   
  98.   #if TARGET_IS_GDB
  99. --- 32,40 ----
  100.              SRCS = calldbx.c command.c dbx.c dialog.c datadpy.c filemenu.c \
  101.             handler.c parser.c regex.c signs.c signals.c source.c \
  102. !           utils.c windows.c xdbx.c $(mallocc)
  103.   
  104.              OBJS = calldbx.o command.o dbx.o dialog.o datadpy.o filemenu.o \
  105.             handler.o parser.o regex.o signs.o signals.o source.o \
  106. !           utils.o windows.o xdbx.o $(malloco)
  107.   
  108.   #if TARGET_IS_GDB
  109. diff -rc2 v1.01/Makefile v1.03/Makefile
  110. *** v1.01/Makefile    Tue Jan 15 11:18:58 1991
  111. --- v1.03/Makefile    Tue Apr  2 09:35:10 1991
  112. ***************
  113. *** 228,233 ****
  114.   DEFGDB =  -DGDB -g
  115.   
  116. !         DEFINES = -DSUNOS4 $(DEFGDB)
  117.   
  118.           DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  119.   LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  120. --- 228,236 ----
  121.   DEFGDB =  -DGDB -g
  122.   
  123. !     DEFINES = -DSUNOS4 $(DEFGDB)
  124.   
  125. + mallocc = #malloc.c
  126. + malloco = #malloc.o
  127.           DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  128.   LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  129. ***************
  130. *** 235,243 ****
  131.              SRCS = calldbx.c command.c dbx.c dialog.c datadpy.c filemenu.c \
  132.             handler.c parser.c regex.c signs.c signals.c source.c \
  133. !           utils.c windows.c xdbx.c
  134.   
  135.              OBJS = calldbx.o command.o dbx.o dialog.o datadpy.o filemenu.o \
  136.             handler.o parser.o regex.o signs.o signals.o source.o \
  137. !           utils.o windows.o xdbx.o
  138.   
  139.    PROGRAM = xxgdb
  140. --- 238,246 ----
  141.              SRCS = calldbx.c command.c dbx.c dialog.c datadpy.c filemenu.c \
  142.             handler.c parser.c regex.c signs.c signals.c source.c \
  143. !           utils.c windows.c xdbx.c $(mallocc)
  144.   
  145.              OBJS = calldbx.o command.o dbx.o dialog.o datadpy.o filemenu.o \
  146.             handler.o parser.o regex.o signs.o signals.o source.o \
  147. !           utils.o windows.o xdbx.o $(malloco)
  148.   
  149.    PROGRAM = xxgdb
  150. diff -rc2 v1.01/XXGDB_README v1.03/XXGDB_README
  151. *** v1.01/XXGDB_README    Tue Jan 15 12:34:20 1991
  152. --- v1.03/XXGDB_README    Tue Apr 16 09:03:21 1991
  153. ***************
  154. *** 57,60 ****
  155. --- 57,94 ----
  156.    *  XXGDB Created:       December, 1990
  157.    *
  158. +  *****************************************************************************
  159. +  *
  160. +  *  Modifications for use under System V
  161. +  *
  162. +  *      Copyright 1990 Bull Worldwide Information Systems, Inc.
  163. +  *
  164. +  *  Permission to use, copy, modify, and distribute this software and its
  165. +  *  documentation for any purpose and without fee is hereby granted,
  166. +  *  provided that the above copyright notice appear in all copies and that
  167. +  *  both that copyright notice and this permission notice appear in
  168. +  *  supporting documentation, and that the name of Bull Worldwide
  169. +  *  Information Systems not be used in advertising or publicity pertaining
  170. +  *  to distribution of the software without specific, written prior
  171. +  *  permission.  Bull makes no representations about the suitability of
  172. +  *  this software for any purpose.  It is provided "as is" without express
  173. +  *  or implied warranty.
  174. +  *
  175. +  *  BULL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  176. +  *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
  177. +  *  SHALL BULL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
  178. +  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  179. +  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  180. +  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  181. +  *  SOFTWARE.
  182. +  *
  183. +  *  Adaptation to SYSV: James Tsillas
  184. +  *                      March, 1991
  185. +  *
  186. +  *****************************************************************************
  187. +  *
  188. +  *    Note that this software uses some files which are 
  189. +  *  Copyright (C) 1985 Free Software Foundation, Inc.
  190. +  *    See copyright header in regex.c and regex.h.
  191. +  *
  192.    *****************************************************************************/
  193.   
  194. ***************
  195. *** 74,79 ****
  196.       Thomson Consumer Electronics, Inc.
  197.   
  198. ! XXGDB version 1.0
  199. ! -----------------
  200.   
  201.       >> SEE ALSO XDBX DOCUMENTATION <<
  202. --- 108,113 ----
  203.       Thomson Consumer Electronics, Inc.
  204.   
  205. ! XXGDB version 1.03
  206. ! ------------------
  207.   
  208.       >> SEE ALSO XDBX DOCUMENTATION <<
  209. ***************
  210. *** 89,97 ****
  211.       See the XDBX_README file for more information on XDBX.
  212.       
  213. !     XXGDB has been tested on SUN 4 running OS 4.1
  214. !         
  215. !     - The name of the debugger called by xxgdb is by default 'gdb'.
  216. !     It can be overridden with the environment variable XXGDB_DEBUGGER.
  217.       
  218.       - XXGDB changes the GDB default 'set prettyprint' to ON. This is
  219.       necessary to be able to display the pointed object when clicking
  220. --- 123,141 ----
  221.       See the XDBX_README file for more information on XDBX.
  222.       
  223. !     XXGDB has been originally tested on SUN 4 running OS 4.1.
  224. !     It should also run on SUN OS3.
  225.       
  226. +     Also, any System V should be able to build by setting the -DSYSV flag.
  227. +     SCO Unix also requires the -Dsco flag. Bull DPX/2 [23]00 requires the
  228. +     -Dncl_mr flag as well as -DSYSV. Some systems may also need to set
  229. +     -DUSG to use the GNU malloc instead of the native one. The GNU malloc
  230. +     works much quicker and is much more reliable. SCO Unix requires GNU
  231. +     malloc to work correctly. GNU malloc is not provided here, you should
  232. +     get malloc.c and getpagesize.h from the source of gdb.
  233. +     Also note that if building on SCO you must also link with -lsocket
  234. +     and if building on DPX/2 you must also link with -linet. You will need
  235. +     the R4 release of X11 for both.
  236. +             
  237.       - XXGDB changes the GDB default 'set prettyprint' to ON. This is
  238.       necessary to be able to display the pointed object when clicking
  239. ***************
  240. *** 105,109 ****
  241.       listed line and will make sure that this last line is visible
  242.       in the source window.
  243. !         
  244.       To build xxgdb, 'Imakefile' defines :
  245.       
  246. --- 149,185 ----
  247.       listed line and will make sure that this last line is visible
  248.       in the source window.
  249. !     
  250. !     - The file button will execute 'core-file <filename>' if the file
  251. !     is named 'core', 'list <filename>:1' if the file is not executable
  252. !     and 'exec-file <filename> symbol-file <filename> if the file
  253. !     is executable. Executable files are displayed with a trailing '*'
  254. !     character.
  255. !     
  256. !     - For systems which do not have the ANSI strstr function in their
  257. !     library, one is included in gdb_parser.c and is compiled if NEED_STRSTR
  258. !     is defined.
  259. !     
  260. !     - if you define UNDISPWIN when compiling, then the display window
  261. !     will disappear when there is nothing to display.
  262. !     (eg, add -DUNDISPWIN in DEFGDB definition in Imakefile).
  263. !     See display_info_handler function in gdb_handler.c
  264. !     
  265. !     - The name of the debugger called by xxgdb is by default 'gdb'.
  266. !     It can be overridden with the environment variable XXGDB_DEBUGGER.
  267. !     
  268. !     - DO NOT modify the gdb prompt (using the 'set prompt' command).
  269. !     XXGDB assumes that the gdb prompt is 'gdb' or the XXGDB_DEBUGGER
  270. !     environment variable if defined.
  271. !     
  272. !     There are two new application resources and command line args:
  273. !         - db_name can be used to specify the name of the debugger to
  274. !      override the default "gdb" (instead of using an env. variable).
  275. !      - db_prompt can be used to specify to xgdb the string to be used by
  276. !      the debugger as a prompt.  The default is to expect the prompt
  277. !      used by the debugger to be the name of the debugger enclosed in
  278. !      parenthesis.   This is no good for gdbvx, which expects a prompt
  279. !      of (gdb).
  280.       To build xxgdb, 'Imakefile' defines :
  281.       
  282. ***************
  283. *** 117,121 ****
  284.   The following bugs will probably be fixed in future versions.
  285.   
  286. !     - 'define' command of GDB is NOT supported by xxgdb.
  287.       
  288.       - 'source' command of XXGDB behaves slighlty differently from 
  289. --- 193,199 ----
  290.   The following bugs will probably be fixed in future versions.
  291.   
  292. !     - 'define' command of GDB is not completely supported by xxgdb
  293. !         because xxgdb does not interpret what the defined commands
  294. !         do.
  295.       
  296.       - 'source' command of XXGDB behaves slighlty differently from 
  297. ***************
  298. *** 136,145 ****
  299.   XXGDB history
  300.   -------------
  301.       1.0        December 1990.
  302. !     1.01    January 1991.
  303.                   Fix bug with display command (when displaying structures).
  304.                   Fix bug with undisplay command (display window went blank).
  305.                   Add XXGDB no warranty message at start-up.
  306.   
  307.                   --------------------------
  308. --- 214,246 ----
  309.   XXGDB history
  310.   -------------
  311. !     
  312.       1.0        December 1990.
  313. !     1.01    January 1991 (posted to comp.sources.x news group)
  314.                   Fix bug with display command (when displaying structures).
  315.                   Fix bug with undisplay command (display window went blank).
  316.                   Add XXGDB no warranty message at start-up.
  317. +     1.02    February 1991.
  318. +                 Add source files selection in file button.
  319. +                 Special test for core file in file button.
  320. +                 Fix bug includeDir resource.
  321. +                 Fix bug source file directories.
  322. +                 Add patches for SUN-OS3.
  323. +                 Add strstr function in gdb_parser.c (with #ifdef NEED_STRSTR)
  324. +                 Remove bad test for MIPS and BSD in case of GDB.
  325. +     1.03    April 1991
  326. +                 Miscellaneous patches for lint.
  327. +                 Port to SYSV + SCO +SYSV32.
  328. +                 Fix bug up/down/frame when arguments are on several lines.
  329. +                 Fix bug in UpdateMessageWindow when arguments are too long.
  330. +                 Fix bug define commands in .gdbinit or source files
  331. +                 Add db_name and db_prompt option (GWC)
  332. +                 
  333.   
  334. + Acknowledgement
  335. + ---------------
  336. +     Thanks to Guy Cherry (GWC) for his numerous bug reports and
  337. +     suggestions, and to all of you who helped improve xxgdb.
  338. +     
  339.                   --------------------------
  340. diff -rc2 v1.01/calldbx.c v1.03/calldbx.c
  341. *** v1.01/calldbx.c    Tue Jan 15 11:19:00 1991
  342. --- v1.03/calldbx.c    Fri Apr 19 15:55:06 1991
  343. ***************
  344. *** 69,78 ****
  345. --- 69,93 ----
  346.    */
  347.   
  348. + #ifdef OLDSUNOS
  349. + #include    <sys/ioctl.h>
  350. + #else
  351.   #include    <termio.h>
  352. + #endif
  353.   #include    "global.h"
  354.   
  355. + #ifdef SYSV 
  356. + #ifdef sco
  357. + #  include    <sys/fcntl.h>
  358. + #endif
  359. + #endif
  360.   FILE               *dbxfp = NULL;        /* file pointer to dbx */
  361.   int                dbxpid = 0;        /* dbx process id */
  362.   
  363. + #ifdef SYSV
  364. + char            dbxfbuf[BUFSIZ];        
  365. + #endif
  366.   static int    dbxInputId;        /* dbx input id */
  367.   static char     pty[11] = "/dev/pty??";    /* master side of pseudo-terminal */
  368. ***************
  369. *** 90,101 ****
  370.       char c;
  371.   
  372. !     for (c='p'; c<='s'; c++) {
  373. !     pty[8] = c;
  374.       for (i=0; i<16; i++) {
  375.           pty[9] = "0123456789abcdef"[i];
  376. !         if ((master = open(pty, O_RDWR)) != -1) 
  377.           return (master); 
  378.       }
  379. !     }
  380.   #ifdef GDB
  381.       fprintf(stderr, "xxgdb: all ptys in use\n");
  382. --- 105,124 ----
  383.       char c;
  384.   
  385. ! #ifndef sco
  386. !     for (c='p'; c<'t'; c++) {
  387.       for (i=0; i<16; i++) {
  388. + #else
  389. +     c = 'p';
  390. +     for (i=0; i<8; i++) {
  391. + #endif
  392. +         pty[8] = c;
  393.           pty[9] = "0123456789abcdef"[i];
  394. !         if ((master = open(pty, O_RDWR)) >= 0) 
  395.           return (master); 
  396.       }
  397. ! #ifndef sco
  398. !     }
  399. ! #endif
  400.   #ifdef GDB
  401.       fprintf(stderr, "xxgdb: all ptys in use\n");
  402. ***************
  403. *** 112,116 ****
  404.       tty[8] = pty[8];
  405.       tty[9] = pty[9];
  406. !     if ((slave = open(tty, O_RDWR)) != -1)
  407.       return (slave);
  408.       fprintf(stderr, "open: cannot open slave pty %s", tty);
  409. --- 135,139 ----
  410.       tty[8] = pty[8];
  411.       tty[9] = pty[9];
  412. !     if ((slave = open(tty, O_RDWR)) >= 0)
  413.       return (slave);
  414.       fprintf(stderr, "open: cannot open slave pty %s", tty);
  415. ***************
  416. *** 123,127 ****
  417. --- 146,154 ----
  418.   char *argv[];
  419.   {
  420. + #ifndef OLDSUNOS
  421.       struct termio Termio;
  422. + #else
  423. +     struct sgttyb Termio;
  424. + #endif
  425.       int        master;        /* file descriptor of master pty */
  426.       int        slave;         /* file descriptor of slave pty */
  427. ***************
  428. *** 137,142 ****
  429.       debugger = (char *) getenv("DEBUGGER");    /* first looks up env var */
  430.   #endif
  431.       if (debugger == NULL)
  432. !     debugger = XtNewString(DEBUGGER);
  433.     
  434.       /* construct dbx prompt string based on the name of debugger invoked */
  435. --- 164,181 ----
  436.       debugger = (char *) getenv("DEBUGGER");    /* first looks up env var */
  437.   #endif
  438. + /* CRL mod 4 3/15/91 GWC if no env var then try app res for db_name */
  439. +     if (debugger == NULL &&
  440. +     app_resources.db_name &&
  441. +     strcmp(app_resources.db_name, "") != NULL)
  442. +     debugger =  XtNewString(app_resources.db_name);
  443. +       
  444.       if (debugger == NULL)
  445. !     debugger  = XtNewString(DEBUGGER);
  446. ! /* CRL mod 4 3/15/91 GWC -  allow the user to specify a db_prompt */
  447. !     if (app_resources.db_prompt &&
  448. !     strcmp(app_resources.db_prompt, "") != NULL)
  449. !     dbxprompt = XtNewString(app_resources.db_prompt);
  450.     
  451.       /* construct dbx prompt string based on the name of debugger invoked */
  452. ***************
  453. *** 152,156 ****
  454. --- 191,197 ----
  455.        */
  456.       if ((fd = open("/dev/tty", O_RDWR)) > 0) {
  457. + #ifndef SYSV 
  458.       ioctl(fd, TIOCNOTTY, 0);
  459. + #endif /* SYSV */
  460.       close(fd);
  461.       }
  462. ***************
  463. *** 157,161 ****
  464. --- 198,205 ----
  465.   
  466.       master = open_master();
  467. +     
  468. + #ifndef SYSV 
  469.       slave = open_slave();
  470. + #endif
  471.   
  472.       dbxpid = fork();
  473. ***************
  474. *** 181,186 ****
  475.       close(1);
  476.       fcntl(master, F_SETFL, FNDELAY);
  477. !         dbxfp = fdopen(master, "r+");
  478. !     setlinebuf(dbxfp);
  479.       dbxInputId = XtAppAddInput(app_context, master, XtInputReadMask, 
  480.                      read_dbx, NULL);
  481. --- 225,242 ----
  482.       close(1);
  483.       fcntl(master, F_SETFL, FNDELAY);
  484. !     
  485. !     dbxfp = fdopen(master, "r+");
  486. !     
  487. !     /* (PW)10APR91 : I use 'setvbuf' instead of 'setlinebuf',
  488. !     because I had a problem with 'define' commands in source
  489. !     of gdbinit files. Also for SYSV setvbuf is required. */
  490. !  /*    setlinebuf(dbxfp); */
  491. !    
  492. ! #ifdef SYSV
  493. !     setvbuf(dbxfp, dbxfbuf, _IONBF, BUFSIZ); */
  494. ! #else
  495. !     setvbuf(dbxfp, NULL, _IONBF, 0);
  496. ! #endif
  497.       dbxInputId = XtAppAddInput(app_context, master, XtInputReadMask, 
  498.                      read_dbx, NULL);
  499. ***************
  500. *** 193,196 ****
  501. --- 249,257 ----
  502.        *       exec dbx with arguments
  503.        */
  504. +       
  505. + #ifdef SYSV 
  506. +         setpgrp();
  507. +         slave = open_slave();
  508. + #endif
  509.       close(master);
  510.   
  511. ***************
  512. *** 198,201 ****
  513. --- 259,264 ----
  514.        * Modify local and output mode of slave pty
  515.        */
  516. +      
  517. + #ifndef OLDSUNOS
  518.       ioctl(slave, TCGETA, &Termio);
  519.       Termio.c_lflag &= ~ECHO;    /* No echo */
  520. ***************
  521. *** 202,205 ****
  522. --- 265,274 ----
  523.       Termio.c_oflag &= ~ONLCR;    /* Do not map NL to CR-NL on output */
  524.       ioctl(slave, TCSETA, &Termio);
  525. + #else
  526. +     ioctl(slave, TIOCGETP, &Termio);
  527. +     Termio.sg_flags &= ~ECHO;    /* No echo */
  528. +     Termio.sg_flags &= ~CRMOD;    /* Do not map NL to CR-NL on output */
  529. +     ioctl(slave, TIOCSETP, &Termio);
  530. + #endif
  531.   
  532.       dup2(slave, 0);
  533. ***************
  534. *** 208,211 ****
  535. --- 277,281 ----
  536.       if (slave > 2)
  537.           close(slave);
  538. +         
  539.       fcntl(1, F_SETFL, FAPPEND);
  540.       setbuf(stdout, NULL);
  541. ***************
  542. *** 215,218 ****
  543. --- 285,289 ----
  544.        * so we can change the group of the terminal.
  545.        */
  546. + #ifndef SYSV
  547.       ioctl(0, TIOCGPGRP, &pgrp);
  548.       setpgrp(0, pgrp);
  549. ***************
  550. *** 226,229 ****
  551. --- 297,301 ----
  552.       ioctl(0, TIOCSPGRP, &pid);
  553.       setpgrp(0, pid);
  554. + #endif /* not SYSV */
  555.   
  556.       argv[0] = debugger;
  557. diff -rc2 v1.01/command.c v1.03/command.c
  558. *** v1.01/command.c    Tue Jan 15 11:19:01 1991
  559. --- v1.03/command.c    Fri Apr 12 17:04:49 1991
  560. ***************
  561. *** 101,107 ****
  562. --- 101,109 ----
  563.   static char    command[LINESIZ];
  564.   static CommandRec *commandQueue = NULL;
  565. + #ifndef GDB
  566.   #ifdef BSD
  567.   static char    savedCommand[LINESIZ] = ""; 
  568.   #endif
  569. + #endif    /* not GDB */
  570.   
  571.   /* ARGSUSED */
  572. ***************
  573. *** 328,332 ****
  574. --- 330,338 ----
  575.       XtPointer call_data;
  576.   {
  577. + #ifdef SYSV 
  578. +     int status;
  579. + #else
  580.       union wait status;
  581. + #endif /* SYSV */
  582.   
  583.       write_dbx("quit\n");
  584. ***************
  585. *** 333,337 ****
  586. --- 339,347 ----
  587.       XtDestroyApplicationContext(app_context);
  588.       kill(dbxpid, SIGKILL);
  589. + #ifdef SYSV 
  590. +     waitpid(&status, NULL, WNOHANG);
  591. + #else
  592.       wait3(&status, WNOHANG, NULL);
  593. + #endif /* SYSV */
  594.       exit(0);
  595.   }
  596. ***************
  597. *** 767,771 ****
  598. --- 777,783 ----
  599.                         parent, args, n);
  600.       CreateButtons(commandWindow);
  601. + #ifndef SYSV 
  602.       getwd(cwd);
  603. + #endif
  604.   }
  605.   
  606. ***************
  607. *** 783,786 ****
  608. --- 795,799 ----
  609.       CommandRec *p, *q, *r;
  610.   
  611. + #ifndef GDB 
  612.   #ifdef BSD 
  613.       /* Save the command if it is not a blank command; else use the 
  614. ***************
  615. *** 791,794 ****
  616. --- 804,808 ----
  617.       strcpy(command, savedCommand);
  618.   #endif
  619. + #endif    /* not GDB */
  620.   
  621.       p = (CommandRec *)XtNew(CommandRec);
  622. ***************
  623. *** 804,807 ****
  624. --- 818,823 ----
  625.       }
  626.       write_dbx(command);
  627. +     
  628. +     Prompt = FALSE;        /* (PW)12APR91 : no more Prompt now. */
  629.   }
  630.   
  631. diff -rc2 v1.01/datadpy.c v1.03/datadpy.c
  632. *** v1.01/datadpy.c    Tue Jan 15 11:19:03 1991
  633. --- v1.03/datadpy.c    Mon Apr 15 09:19:39 1991
  634. ***************
  635. *** 74,78 ****
  636.    *   pop_down():    pop down the popup and free storage.
  637.    *   DestroyDataPopup():event handler for destroying a popup, call DeleteList()
  638. !  *            and pop_down().
  639.    *   MovePopup():    Position the popup.
  640.    *   print_handler():    Action handler for displaying pointers and structures.
  641. --- 74,78 ----
  642.    *   pop_down():    pop down the popup and free storage.
  643.    *   DestroyDataPopup():event handler for destroying a popup, call DeleteList()
  644. !  *            and pop_down() (CRL mod 25)
  645.    *   MovePopup():    Position the popup.
  646.    *   print_handler():    Action handler for displaying pointers and structures.
  647. ***************
  648. *** 101,105 ****
  649. --- 101,111 ----
  650.   static DataDpyList    *TopParentList = NULL;
  651.   static int        font_height, font_width;
  652. + #ifdef OBSOLETE
  653.   static void        DestroyDataPopup();
  654. + #else
  655. + /* CRL mod 25 4/12/91 GWC - changed label widget to command widget in popups */
  656. + static void        DestroyDataCallback();
  657. + #endif
  658.   
  659.   /* 
  660. ***************
  661. *** 287,294 ****
  662.       XtSetArg(args[n], XtNresize, (XtArgVal) False);                        n++;
  663.       XtSetArg(args[n], XtNjustify, (XtArgVal) XtJustifyCenter);             n++;
  664.       dataDpy->label = XtCreateManagedWidget("label", labelWidgetClass, 
  665.       dataDpy->popup, args, n);
  666. !     XtAddEventHandler(dataDpy->label, (EventMask) ButtonPressMask, False, 
  667.       DestroyDataPopup, dataDpy);
  668.   
  669.       /* Create the text window */
  670. --- 293,310 ----
  671.       XtSetArg(args[n], XtNresize, (XtArgVal) False);                        n++;
  672.       XtSetArg(args[n], XtNjustify, (XtArgVal) XtJustifyCenter);             n++;
  673. + #ifdef OBSOLETE
  674.       dataDpy->label = XtCreateManagedWidget("label", labelWidgetClass, 
  675.       dataDpy->popup, args, n);
  676. ! /*    GWC says it is better to use ButtonReleaseMask instead of ButtonPressMask.*/
  677. !     XtAddEventHandler(dataDpy->label, (EventMask) ButtonPressMask, False, 
  678.       DestroyDataPopup, dataDpy);
  679. + #else
  680. + /* CRL mod 25 4/12/91 GWC - changed label widget to command widget in
  681. + popups */
  682. +     dataDpy->label = XtCreateManagedWidget("command", commandWidgetClass, 
  683. +           dataDpy->popup, args, n);
  684. +     XtAddCallback(dataDpy->label, XtNcallback, DestroyDataCallback, dataDpy);
  685. + #endif
  686.   
  687.       /* Create the text window */
  688. ***************
  689. *** 484,487 ****
  690. --- 500,505 ----
  691.    */
  692.   /* ARGSUSED */
  693. + #ifdef OBSOLETE
  694.   static void DestroyDataPopup(w, dataDpy, event)
  695.       Widget w;
  696. ***************
  697. *** 488,491 ****
  698. --- 506,516 ----
  699.       DataDpyRec *dataDpy;
  700.       XEvent *event;
  701. + #else
  702. + /* CRL mod 25 4/12/91 GWC - changed label widget to command widget */
  703. + static void DestroyDataCallback(w, dataDpy, call_data)
  704. +     Widget w;
  705. +     DataDpyRec *dataDpy;
  706. +     caddr_t call_data;
  707. + #endif
  708.   {
  709.       if (!dataDpy->parent)
  710. ***************
  711. *** 600,604 ****
  712.       if (Parent)
  713.           XDefineCursor(display, XtWindow(Parent->dataDpyWindow), watch);
  714. !     UpdateMessageWindow("Click the label to pop down the data popup");
  715.   
  716.       /* Searches the table for an unused or empty slot */
  717. --- 625,629 ----
  718.       if (Parent)
  719.           XDefineCursor(display, XtWindow(Parent->dataDpyWindow), watch);
  720. !     UpdateMessageWindow("Click the label to pop down the data popup",NULL);
  721.   
  722.       /* Searches the table for an unused or empty slot */
  723. diff -rc2 v1.01/dbx.c v1.03/dbx.c
  724. *** v1.01/dbx.c    Tue Jan 15 11:19:04 1991
  725. --- v1.03/dbx.c    Fri Apr 12 17:05:54 1991
  726. ***************
  727. *** 88,117 ****
  728.   char *xdbxinit;
  729.   {
  730.       FILE *fp;
  731.       char s[LINESIZ];
  732.   
  733.       if (strcmp(xdbxinit, "") == NULL)
  734.       return;
  735. !     if (fp = fopen(xdbxinit, "r")) {
  736. !     while (fgets(s, LINESIZ, fp)) {
  737.   #ifdef GDB
  738. !         /* if GDB:
  739. !             Check for comment line,
  740. !             DO NOT SEND '\n',
  741. !             Take care of source command.
  742. !         */
  743. !         if ((*s != '#') && strcmp(s,"\n") && (!gdb_source_command(s,TRUE))) {    
  744. ! #endif /* GDB */
  745. !         send_command(s);
  746. !         AppendDialogText(s);
  747. !         Prompt = False;
  748. !         while (!Prompt)
  749. !         read_dbx();
  750. ! #ifdef GDB
  751.           }
  752. - #endif /* GDB */
  753. -     }
  754.       close(fp);
  755.       }
  756.   }
  757.   
  758. --- 88,115 ----
  759.   char *xdbxinit;
  760.   {
  761. + #ifndef GDB
  762.       FILE *fp;
  763.       char s[LINESIZ];
  764. + #endif /* not GDB */
  765.   
  766.       if (strcmp(xdbxinit, "") == NULL)
  767.       return;
  768. !     
  769.   #ifdef GDB
  770. !     read_source_file(xdbxinit);
  771. !     
  772. ! #else /* not GDB */
  773. !     if (fp = fopen(xdbxinit, "r")) {
  774. !         while (fgets(s, LINESIZ, fp)) {
  775. !             send_command(s);
  776. !             AppendDialogText(s);
  777. !             Prompt = False;
  778. !             while (!Prompt)
  779. !                 read_dbx();
  780.           }
  781.       close(fp);
  782.       }
  783. + #endif /* not GDB */
  784.   }
  785.   
  786. ***************
  787. *** 219,222 ****
  788. --- 217,221 ----
  789.   }
  790.   
  791. + #ifdef GDB
  792.   /*  Sends a command to dbx and read the corresponding output, directly
  793.    *  invoking the Xt input procedure, read_dbx().
  794. ***************
  795. *** 225,228 ****
  796. --- 224,237 ----
  797.   char *command;
  798.   {
  799. +     query_dbx_echo(command, False);
  800. + }
  801. + #else
  802. + /*  Sends a command to dbx and read the corresponding output, directly
  803. +  *  invoking the Xt input procedure, read_dbx().
  804. +  */
  805. + void query_dbx(command)
  806. + char *command;
  807. + {
  808.       write_dbx(command);
  809.       insert_command(command);
  810. ***************
  811. *** 236,237 ****
  812. --- 245,247 ----
  813.       Echo = True;
  814.   }
  815. + #endif
  816. diff -rc2 v1.01/defs.h v1.03/defs.h
  817. *** v1.01/defs.h    Tue Jan 15 11:19:05 1991
  818. --- v1.03/defs.h    Fri Apr 12 10:06:28 1991
  819. ***************
  820. *** 147,150 ****
  821. --- 147,154 ----
  822.       String    prompt;        /* prompt string for xdbx */
  823.   
  824. + /* CRL mod 4 3/15/91 GWC - added two new app res */
  825. +     String    db_name;      /* name for dbx child */
  826. +     String    db_prompt;    /* prompt for dbx child */
  827.       Pixel     stop_color;    /* color of stop sign */
  828.       Pixel     arrow_color;    /* color of arrow sign */
  829. diff -rc2 v1.01/dialog.c v1.03/dialog.c
  830. *** v1.01/dialog.c    Tue Jan 15 11:19:06 1991
  831. --- v1.03/dialog.c    Mon Mar 11 15:59:05 1991
  832. ***************
  833. *** 237,242 ****
  834.       Cardinal *num_params;
  835.   {
  836.       FalseSignal = TRUE;
  837. !     killpg(dbxpid, SIGINT);
  838.   }
  839.   
  840. --- 237,246 ----
  841.       Cardinal *num_params;
  842.   {
  843. + #ifndef GDB
  844.       FalseSignal = TRUE;
  845. !    killpg(dbxpid, SIGINT);
  846. ! #else      
  847. !     write_dbx("\003");    /* (PW)18FEB91 : seems to work better */
  848. ! #endif    /* GDB */
  849.   }
  850.   
  851. diff -rc2 v1.01/filemenu.c v1.03/filemenu.c
  852. *** v1.01/filemenu.c    Tue Jan 15 11:19:07 1991
  853. --- v1.03/filemenu.c    Wed Apr  3 14:12:30 1991
  854. ***************
  855. *** 81,84 ****
  856. --- 81,92 ----
  857.   #include <X11/Xos.h>
  858.   #include <sys/stat.h>
  859. + #ifdef SYSV 
  860. + #include <stdio.h>
  861. + #include <sys/param.h>
  862. + #include <sys/types.h>
  863. + #include <dirent.h>
  864. + #endif
  865.   #ifdef SUNOS4
  866.   #include <dirent.h>
  867. ***************
  868. *** 91,95 ****
  869.   #define FILES_PER_COL   10              /* # of files per column in file menu */
  870.   
  871. - char        cwd[MAXPATHLEN];    /* current working directory of dbx */
  872.   static char    fileMenuDir[MAXPATHLEN];/* current directory of file menu */
  873.   static char      **filelist;         /* list of file names in fileMenu */
  874. --- 99,102 ----
  875. ***************
  876. *** 111,120 ****
  877.   {
  878.       char command[LINESIZ];
  879.   
  880. ! #ifdef BSD
  881. !     int i;
  882. !     if (strcmp(dir, "./") == NULL) 
  883. !     return;
  884.       if (dir[0] == '/' || dir[0] == '~') 
  885.       strcpy(cwd, dir);
  886. --- 118,127 ----
  887.   {
  888.       char command[LINESIZ];
  889. +     char store[LINESIZ];
  890. +     int i,j;
  891.   
  892. !     if(!strcmp(dir, "./")) return;
  893. !     
  894. ! #if defined(BSD)
  895.       if (dir[0] == '/' || dir[0] == '~') 
  896.       strcpy(cwd, dir);
  897. ***************
  898. *** 130,134 ****
  899.       }
  900.   #else
  901. !     sprintf(command, "cd %s\n", dir);
  902.       query_dbx(command);
  903.   #endif
  904. --- 137,154 ----
  905.       }
  906.   #else
  907. !     if(!strcmp(dir,"../"))
  908. !        {
  909. !      for(i=0,j=0; cwd[i]; i++) if(cwd[i]=='/')j++;
  910. !      if( j == 1 ) strcpy(store,"/");
  911. !      else
  912. !        strcpy(store,"..");
  913. !        }
  914. !     else
  915. !       {
  916. !     if(!strcmp(cwd, "/"))cwd[0]='\0';
  917. !     sprintf(store,"%s/%s", cwd, dir);
  918. !     LASTCH(store)='\0';
  919. !       }
  920. !     sprintf(command, "cd %s\n", store);
  921.       query_dbx(command);
  922.   #endif
  923. ***************
  924. *** 143,146 ****
  925. --- 163,167 ----
  926.    *    executable files
  927.    */
  928. + #ifndef SYSV
  929.   static int InList(entry)
  930.   Directory *entry;
  931. ***************
  932. *** 172,182 ****
  933.       return True;
  934.       }
  935. - #ifdef GDB
  936. -     /* for GDB, we only want directories and executable files */
  937. -     return FALSE;
  938. - #else
  939.       return True;
  940. - #endif /* GDB */
  941.   }
  942.   
  943.   
  944. --- 193,199 ----
  945.       return True;
  946.       }
  947.       return True;
  948.   }
  949. + #endif /* not SYSV */
  950.   
  951.   
  952. ***************
  953. *** 189,196 ****
  954.   char *dir;
  955.   {
  956.       extern     alphasort();
  957.       Directory   **namelist;
  958. !     int        i, j;
  959.   
  960.       nfiles = scandir(dir, &namelist, InList, alphasort);
  961.       if (nfiles == -1) {
  962. --- 206,229 ----
  963.   char *dir;
  964.   {
  965. + #ifndef SYSV 
  966.       extern     alphasort();
  967.       Directory   **namelist;
  968. ! #else
  969. !     struct dirent *WorkingDirEntry;
  970. !     DIR *WorkingDir;
  971. !     char store[LINESIZ];
  972. ! #endif
  973. !     register int        i,j;
  974.   
  975. + #ifdef SYSV 
  976. +     if(!(WorkingDir = opendir(dir)))
  977. +       {
  978. +     UpdateMessageWindow("scandir: cannot open %s", dir);
  979. +     return;
  980. +       }
  981. +     nfiles=0;
  982. +     while(readdir(WorkingDir))nfiles++;
  983. +     rewinddir(WorkingDir);
  984. + #else    
  985.       nfiles = scandir(dir, &namelist, InList, alphasort);
  986.       if (nfiles == -1) {
  987. ***************
  988. *** 198,201 ****
  989. --- 231,235 ----
  990.       return;
  991.       }
  992. + #endif
  993.       if (filelist) {
  994.       for (i=0; filelist[i]; i++)
  995. ***************
  996. *** 206,214 ****
  997.       i = 0;
  998.       for (j=0; j<nfiles; j++) {
  999. !     filelist[i++] = XtNewString(namelist[j]->d_name);
  1000. !         XtFree(namelist[j]);
  1001.       }
  1002.       filelist[i++] = NULL;
  1003.       XtFree(namelist);
  1004.       return;
  1005.   }
  1006. --- 240,291 ----
  1007.       i = 0;
  1008.       for (j=0; j<nfiles; j++) {
  1009. ! #ifdef SYSV 
  1010. !       WorkingDirEntry = readdir(WorkingDir);
  1011. !       if(!strcmp(WorkingDirEntry->d_name, "."))
  1012. !       strcpy(store, "./");
  1013. !       else
  1014. !     {
  1015. !       if(!strcmp(WorkingDirEntry->d_name, ".."))
  1016. !         strcpy(store, "../");
  1017. !       else
  1018. !         {
  1019. !           struct stat statbuf;
  1020. !           
  1021. !           sprintf(store,"%s/%s",cwd,WorkingDirEntry->d_name);
  1022. !           if(stat(store, &statbuf) == -1)
  1023. !         store[0]='\0';
  1024. !           else
  1025. !         {
  1026. !           if (statbuf.st_mode & S_IFDIR)
  1027. !             sprintf(store, "%s/", WorkingDirEntry->d_name);
  1028. !           else
  1029. !             if (statbuf.st_mode & S_IEXEC)
  1030. !               sprintf(store, "%s*", WorkingDirEntry->d_name);
  1031. !             else
  1032. !               if(LASTCH(WorkingDirEntry->d_name) == '~' ||
  1033. !              LASTCH(WorkingDirEntry->d_name) == '#' ||
  1034. !              WorkingDirEntry->d_name[0] == '.' ||
  1035. !              (LASTCH(WorkingDirEntry->d_name) == 'o' && 
  1036. !               SECLASTCH(WorkingDirEntry->d_name) == '.'))
  1037. !             store[0]='\0';
  1038. !               else
  1039. !             strcpy(store, WorkingDirEntry->d_name);
  1040. !         }
  1041. !         }
  1042. !     }
  1043. !      if(store[0])    
  1044. !        filelist[i++] = XtNewString(store);
  1045. ! #else /* not SYSV */
  1046. !       filelist[i++] = XtNewString(namelist[j]->d_name);
  1047. !       XtFree(namelist[j]);
  1048. ! #endif
  1049.       }
  1050.       filelist[i++] = NULL;
  1051. + #ifdef SYSV 
  1052. +     closedir(WorkingDir);
  1053. + #else
  1054.       XtFree(namelist);
  1055. + #endif
  1056.       return;
  1057.   }
  1058. ***************
  1059. *** 239,243 ****
  1060.       }
  1061.       else if (LASTCH(filename) == '*') {
  1062. !         UpdateMessageWindow("");
  1063.   #ifdef GDB
  1064.       /* for GDB, we send the commands : exec-file & symbol-file */
  1065. --- 316,320 ----
  1066.       }
  1067.       else if (LASTCH(filename) == '*') {
  1068. !         UpdateMessageWindow("",NULL);
  1069.   #ifdef GDB
  1070.       /* for GDB, we send the commands : exec-file & symbol-file */
  1071. ***************
  1072. *** 278,283 ****
  1073.       }
  1074.       else {
  1075. !         UpdateMessageWindow("");
  1076. ! #ifndef GDB
  1077.       sprintf(command, "file %s\n", filename);
  1078.       send_command(command);
  1079. --- 355,367 ----
  1080.       }
  1081.       else {
  1082. !         UpdateMessageWindow("",NULL);
  1083. ! #ifdef GDB
  1084. !     if (strcmp(filename, "core") == NULL)
  1085. !         sprintf(command, "core-file %s\n", filename);
  1086. !     else
  1087. !         sprintf(command, "list %s:1\n", filename);
  1088. !     send_command(command);
  1089. !         AppendDialogText(command);
  1090. ! #else /* not GDB */
  1091.       sprintf(command, "file %s\n", filename);
  1092.       send_command(command);
  1093. ***************
  1094. *** 297,301 ****
  1095.   {
  1096.       XtPopdown(popupshell);
  1097. !     UpdateMessageWindow("");
  1098.   }
  1099.   
  1100. --- 381,385 ----
  1101.   {
  1102.       XtPopdown(popupshell);
  1103. !     UpdateMessageWindow("",NULL);
  1104.   }
  1105.   
  1106. ***************
  1107. *** 416,424 ****
  1108.       XtPopup(popupshell, XtGrabNonexclusive);
  1109.   
  1110. ! #ifdef GDB
  1111. !     UpdateMessageWindow("Select an executable file or a directory");
  1112. ! #else
  1113. !     UpdateMessageWindow("Select a file or directory");
  1114. ! #endif /* GDB */
  1115.       XUndefineCursor(display, XtWindow(toplevel));
  1116.       XUndefineCursor(display, XtWindow(sourceWindow));
  1117. --- 500,505 ----
  1118.       XtPopup(popupshell, XtGrabNonexclusive);
  1119.   
  1120. !     UpdateMessageWindow("Select a file or directory",NULL);
  1121. !     
  1122.       XUndefineCursor(display, XtWindow(toplevel));
  1123.       XUndefineCursor(display, XtWindow(sourceWindow));
  1124. diff -rc2 v1.01/gdb_handler.c v1.03/gdb_handler.c
  1125. *** v1.01/gdb_handler.c    Tue Jan 15 11:19:13 1991
  1126. --- v1.03/gdb_handler.c    Fri Apr 12 17:06:15 1991
  1127. ***************
  1128. *** 83,89 ****
  1129.    *    done_handler():        Progrm execution completed, clear breakpoints
  1130.    *    source_handler():        Exec commands of source file specified.
  1131. !  *    query_dbx_echo():        Send command with echo on.
  1132.    */
  1133.   
  1134.   
  1135.   void query_dbx_echo();
  1136. --- 83,92 ----
  1137.    *    done_handler():        Progrm execution completed, clear breakpoints
  1138.    *    source_handler():        Exec commands of source file specified.
  1139. !  *    query_dbx_echo():        Send command with echo on or off.
  1140.    */
  1141.   
  1142. + #ifdef SYSV 
  1143. + #   include <signal.h>
  1144. + #endif
  1145.   
  1146.   void query_dbx_echo();
  1147. ***************
  1148. *** 91,101 ****
  1149.   /*  
  1150.    *  Display an outlined arrow to locate the calling routine in a stack
  1151. !  *  frame.  BSD and SUN dbx have slightly different output semantics here.
  1152. !  *  The appropriate file with the calling routine is displayed and the
  1153. !  *  file variable is set accordingly.
  1154.    */
  1155.   void updown_handler()
  1156.   {
  1157. !     char command[LINESIZ], *func, *file;
  1158.       int     line;
  1159.   
  1160. --- 94,102 ----
  1161.   /*  
  1162.    *  Display an outlined arrow to locate the calling routine in a stack
  1163. !  *  frame.
  1164.    */
  1165.   void updown_handler()
  1166.   {
  1167. !     char *func, *file;
  1168.       int     line;
  1169.   
  1170. ***************
  1171. *** 102,111 ****
  1172.       line = Token.line;
  1173.       func = XtNewString(Token.func);
  1174. ! #ifdef MIPS
  1175. !     LoadCurrentFile();
  1176. ! #endif
  1177. ! #ifdef BSD
  1178. !     file = GetPathname(Token.file);
  1179. ! #else
  1180.       if (line <= 0) line = 1;
  1181.       LoadCurrentFile();
  1182. --- 103,107 ----
  1183.       line = Token.line;
  1184.       func = XtNewString(Token.func);
  1185.       if (line <= 0) line = 1;
  1186.       LoadCurrentFile();
  1187. ***************
  1188. *** 112,116 ****
  1189.       if (displayedFile)
  1190.       file = displayedFile->pathname;
  1191. - #endif
  1192.   
  1193.       if (line <= 0 || func == NULL || file == NULL)
  1194. --- 108,111 ----
  1195. ***************
  1196. *** 145,149 ****
  1197.        error message will be displayed ! */
  1198.        
  1199. !      query_dbx_echo("list ,main\n");    /* tell gdb to use main file 
  1200.                                    and get line number of main(). (,main will end at main) */
  1201.      
  1202. --- 140,144 ----
  1203.        error message will be displayed ! */
  1204.        
  1205. !      query_dbx_echo("list ,main\n", TRUE);    /* tell gdb to use main file 
  1206.                                    and get line number of main(). (,main will end at main) */
  1207.      
  1208. ***************
  1209. *** 160,164 ****
  1210.           }
  1211.           
  1212. !     UpdateMessageWindow("Ready for execution");
  1213.       query_dbx("display\n");        /* clear display window */
  1214.   }
  1215. --- 155,159 ----
  1216.           }
  1217.           
  1218. !     UpdateMessageWindow("Ready for execution",NULL);
  1219.       query_dbx("display\n");        /* clear display window */
  1220.   }
  1221. ***************
  1222. *** 187,190 ****
  1223. --- 182,195 ----
  1224.       Cardinal    n;
  1225.   
  1226. + #ifdef UNDISPWIN
  1227. +     /* this code removes the display window when there is nothing to display (GWC) */
  1228. +     
  1229. +     if (!Token.display || strcmp(Token.display, "") == NULL) {
  1230. +         XtUnmanageChild(separator);
  1231. +         XtUnmanageChild(displayWindow);
  1232. +         return;
  1233. +     }
  1234. + #endif /* UNDISPWIN */
  1235.       if (!Token.display || strcmp(Token.display, "") == NULL) {
  1236.       if (!XtIsManaged(displayWindow))
  1237. ***************
  1238. *** 263,268 ****
  1239.   
  1240.   /* ARGSUSED */
  1241. ! void directory_handler(output)
  1242. ! char *output;
  1243.   {
  1244.       /* Note : for GDB, the 'directory' command with no
  1245. --- 268,272 ----
  1246.   
  1247.   /* ARGSUSED */
  1248. ! void directory_handler()
  1249.   {
  1250.       /* Note : for GDB, the 'directory' command with no
  1251. ***************
  1252. *** 416,422 ****
  1253.           
  1254.       if (message)
  1255. !         UpdateMessageWindow(message);
  1256.       else
  1257. !         UpdateMessageWindow(Token.mesg);
  1258.           
  1259.       line = Token.line;
  1260. --- 420,426 ----
  1261.           
  1262.       if (message)
  1263. !         UpdateMessageWindow(message,NULL);
  1264.       else
  1265. !         UpdateMessageWindow(Token.mesg,NULL);
  1266.           
  1267.       line = Token.line;
  1268. ***************
  1269. *** 423,436 ****
  1270.       func = (Token.func) ? XtNewString(Token.func) : 0;
  1271.       
  1272. - #ifdef MIPS
  1273. -     status = LoadCurrentFile();
  1274. - #else
  1275.       if (Token.file)
  1276.       status = LoadFile(Token.file);
  1277. - #endif
  1278.       
  1279. - #ifndef BSD
  1280.       display_info_handler();        /* uses Token.display ! */
  1281. - #endif
  1282.   
  1283.       /* because of tbreak, we have to call info break here */
  1284. --- 427,434 ----
  1285. ***************
  1286. *** 478,483 ****
  1287.   int signal;
  1288.   {
  1289. -     char command[LINESIZ];
  1290.       arrow.line = 0;
  1291.       updown.line = 0;
  1292. --- 476,479 ----
  1293. ***************
  1294. *** 484,490 ****
  1295.       UpdateArrow(displayedFile);
  1296.       UpdateUpdown(displayedFile);
  1297. !     UpdateMessageWindow("Ready for execution");
  1298.   }
  1299.   
  1300.   /* WARNING : source_handler() is NOT called by the parser.
  1301.   It is called by gdb_source_command() in gdb_parser.c.
  1302. --- 480,528 ----
  1303.       UpdateArrow(displayedFile);
  1304.       UpdateUpdown(displayedFile);
  1305. !     UpdateMessageWindow("Ready for execution",NULL);
  1306.   }
  1307.   
  1308. + /*--------------------------------------------------------------------------+
  1309. + |                                                                            |
  1310. + |    Function to read the .dgbinit file or any source file.                    |
  1311. + |                                                                            |
  1312. + |    input : file name.                                                        |
  1313. + |                                                                            |
  1314. + |    output : none.                                                            |
  1315. + |                                                                            |
  1316. + +--------------------------------------------------------------------------*/
  1317. + void read_source_file(file)
  1318. + char *file;
  1319. + {
  1320. + char s[LINESIZ];
  1321. + FILE *fp;
  1322. +     if (fp = fopen(file, "r"))
  1323. +         {
  1324. +         while (fgets(s, LINESIZ, fp))
  1325. +             {
  1326. +             /* Check for comment line,
  1327. +                 DO NOT SEND '\n',
  1328. +                 Take care of source command,
  1329. +                 Take care of define or document commands.
  1330. +             */
  1331. +             
  1332. +             if ((*s != '#') && strcmp(s,"\n"))    
  1333. +                 {
  1334. +                 if (gdb_source_command(s,TRUE) || gdb_define_command(s,fp))
  1335. +                     {
  1336. +                         Prompt = False;
  1337. +                     while (!Prompt)
  1338. +                         read_dbx();
  1339. +                     }
  1340. +                 else
  1341. +                     query_dbx_echo (s, TRUE);
  1342. +                 }
  1343. +             }
  1344. +             
  1345. +         close(fp);
  1346. +         }
  1347. + }
  1348.   /* WARNING : source_handler() is NOT called by the parser.
  1349.   It is called by gdb_source_command() in gdb_parser.c.
  1350. ***************
  1351. *** 496,501 ****
  1352.   {
  1353.   char *file;
  1354. - FILE *fp;
  1355. - char s[LINESIZ];
  1356.   
  1357.       if (!Token.file || strcmp(Token.file, "") == NULL)
  1358. --- 534,537 ----
  1359. ***************
  1360. *** 510,530 ****
  1361.           return;        /* (PW)11JAN91 */
  1362.   
  1363. !     if (fp = fopen(file, "r"))
  1364. !         {
  1365. !         while (fgets(s, LINESIZ, fp))
  1366. !             {
  1367. !             /* DO NOT SEND \n and Take care of source command */
  1368. !             if ((*s != '#') && strcmp(s,"\n") && (!gdb_source_command(s,TRUE)))    
  1369. !                 {
  1370. !                 write_dbx(s);
  1371. !                 insert_command(s);
  1372. !                 AppendDialogText(s);
  1373. !                 Prompt = False;
  1374. !                 while (!Prompt)
  1375. !                     read_dbx();
  1376. !                 }
  1377. !             }
  1378. !         close(fp);
  1379. !         }
  1380.   }
  1381.   
  1382. --- 546,550 ----
  1383.           return;        /* (PW)11JAN91 */
  1384.   
  1385. !     read_source_file(file);
  1386.   }
  1387.   
  1388. ***************
  1389. *** 532,539 ****
  1390.    *  invoking the Xt input procedure, read_dbx().
  1391.    *
  1392. !  *    Same as query_dbx() in dbx.c except that Echo = True.
  1393.    */
  1394. ! void query_dbx_echo(command)
  1395.   char *command;
  1396.   {
  1397.       write_dbx(command);
  1398. --- 552,560 ----
  1399.    *  invoking the Xt input procedure, read_dbx().
  1400.    *
  1401. !  *    Same as query_dbx() in dbx.c except that Echo = True or False.
  1402.    */
  1403. ! void query_dbx_echo(command, echo)
  1404.   char *command;
  1405. + int echo;
  1406.   {
  1407.       write_dbx(command);
  1408. ***************
  1409. *** 540,544 ****
  1410.       insert_command(command);
  1411.   
  1412. !     Echo = True;
  1413.       Prompt = False;
  1414.       while (!Prompt)
  1415. --- 561,565 ----
  1416.       insert_command(command);
  1417.   
  1418. !     Echo = echo;
  1419.       Prompt = False;
  1420.       while (!Prompt)
  1421. ***************
  1422. *** 547,549 ****
  1423. --- 568,608 ----
  1424.       Parse = True;    /* Always reset Parse and Echo to True */
  1425.       Echo = True;
  1426. + }
  1427. + /*  core-file  
  1428. +  *  gdb does not display current line, file, func ..., so we send
  1429. +  *  'frame 0' command to have them.
  1430. +  */
  1431. + void core_file_handler()
  1432. + {
  1433. +     char *message;
  1434. +     int line;
  1435. +     int signal;
  1436. +     
  1437. +     message = XtNewString(Token.mesg);
  1438. +     signal = Token.stop;                    /* signal number received */
  1439. +     
  1440. +     query_dbx("frame 0\n"); /* this will update updown.line, updown.func and
  1441. +                                 updown.file. (see updown_handler) */
  1442. +     
  1443. +     line = updown.line;
  1444. +     updown.line = 0;
  1445. +     
  1446. +     /* Display bomb sign if segmentation fault occurred in source code */
  1447. +     
  1448. +     if (line != 0 && signal == SIGSEGV) {
  1449. +     arrow.line = 0;
  1450. +     bomb.line = line;
  1451. +     strcpy(bomb.func, updown.func);
  1452. +     strcpy(bomb.file, updown.file);
  1453. +     } else {
  1454. +     bomb.line = 0;
  1455. +     arrow.line = line;
  1456. +     strcpy(arrow.func, updown.func);
  1457. +     strcpy(arrow.file, updown.file);
  1458. +     }
  1459. +     
  1460. +     UpdateMessageWindow(message,NULL);
  1461. +     XtFree(message);
  1462. +     AdjustText(line); 
  1463.   }
  1464. diff -rc2 v1.01/gdb_parser.c v1.03/gdb_parser.c
  1465. *** v1.01/gdb_parser.c    Tue Jan 15 11:19:13 1991
  1466. --- v1.03/gdb_parser.c    Fri Apr 12 17:05:32 1991
  1467. ***************
  1468. *** 127,131 ****
  1469.   
  1470.       if (debug) {
  1471. !     fprintf(stderr, "parse(output = %s, command = %s)\n", output, command);
  1472.       }
  1473.   
  1474. --- 127,133 ----
  1475.   
  1476.       if (debug) {
  1477. !     char *temp;
  1478. !     if(!command)temp="";else temp=command;
  1479. !     fprintf(stderr, "parse(output = %s, command = %s)\n", output, temp);
  1480.       }
  1481.   
  1482. ***************
  1483. *** 136,140 ****
  1484.       if (!command) {
  1485.       if (match(output_pattern, output_string, O_DEBUG) != -1)
  1486. !         debug_handler(); 
  1487.       debug_init();
  1488.       XtFree(output_string);
  1489. --- 138,146 ----
  1490.       if (!command) {
  1491.       if (match(output_pattern, output_string, O_DEBUG) != -1)
  1492. !         {
  1493. !         debug_handler();
  1494. !         if (match(output_pattern, output_string, O_CORE_FILE) != -1)
  1495. !             core_file_handler();
  1496. !         }
  1497.       debug_init();
  1498.       XtFree(output_string);
  1499. ***************
  1500. *** 338,341 ****
  1501. --- 344,354 ----
  1502.           break;
  1503.           
  1504. +     case C_CORE_FILE:
  1505. +         if (match(output_pattern, output_string, O_CORE_FILE) != -1)
  1506. +         core_file_handler();
  1507. +         else
  1508. +         bell(0);
  1509. +         break;
  1510. +         
  1511.       default:
  1512.           break;
  1513. ***************
  1514. *** 344,349 ****
  1515. --- 357,394 ----
  1516.   }
  1517.   
  1518. + #ifdef NEED_STRSTR
  1519.   /*--------------------------------------------------------------------------+
  1520.   |                                                                            |
  1521. + |    Some systems DO NOT have the ANSI strstr function                        |
  1522. + |                                                                            |
  1523. + +--------------------------------------------------------------------------*/    
  1524. + char *
  1525. + strstr (source, substr)
  1526. +     char *source;
  1527. +     char *substr;
  1528. + {
  1529. + char *src;
  1530. + char *sub;
  1531. +     if (!source || !substr)
  1532. +         return NULL;
  1533. +         
  1534. +     while (*source)
  1535. +         {
  1536. +         for (src = source, sub = substr;
  1537. +                 (*src) && (*sub) && (*src == *sub);
  1538. +                     src++,sub++);
  1539. +         if (!*sub)
  1540. +             return source;
  1541. +             
  1542. +         source++;
  1543. +         }
  1544. +         
  1545. +     return NULL;
  1546. + }
  1547. + #endif
  1548. + /*--------------------------------------------------------------------------+
  1549. + |                                                                            |
  1550.   |    Function to filter all the display information in a string                |
  1551.   |                                                                            |
  1552. ***************
  1553. *** 459,464 ****
  1554.       char         *p;
  1555.       char         *p2;
  1556. -     char         *p3;
  1557. -     int            r;
  1558.       static Boolean    deleteRest = False;
  1559.       int            command_type = -1;
  1560. --- 504,507 ----
  1561. ***************
  1562. *** 608,609 ****
  1563. --- 651,758 ----
  1564.       return FALSE;
  1565.   }
  1566. + /*--------------------------------------------------------------------------+
  1567. + |                                                                            |
  1568. + |    Function to filter 'define' & 'document' commands                        |
  1569. + |                                                                            |
  1570. + |    input : command (from .gdbinit or source command),                        |
  1571. + |            fp = file pointer.                                                |
  1572. + |                                                                            |
  1573. + |    output : TRUE if define or document command was recognized                |
  1574. + |                                                                            |
  1575. + |    In case the command is recognized, it is executed here.                    |
  1576. + |                                                                            |
  1577. + +--------------------------------------------------------------------------*/
  1578. + int gdb_define_command(command,fp)
  1579. + char *command;
  1580. + FILE *fp;
  1581. + {
  1582. + char s[LINESIZ];
  1583. + int error_cmd;
  1584. + int end_found;
  1585. +     if ((command && (match(command_pattern, command, C_DEFINE) != -1))
  1586. +         || (command && (match(command_pattern, command, C_DOCUMENT) != -1)))
  1587. +         {
  1588. +         AppendDialogText(command);
  1589. +         send_command(command);
  1590. +         
  1591. + /*
  1592. +                 gdb could ask :
  1593. +             
  1594. +                     "Redefine command \"%s\"? "
  1595. +                     "Really redefine built-in command \"%s\"? "
  1596. +                     
  1597. +                 gdb could display 
  1598. +                 
  1599. +                     "Type commands for definition of \"%s\".\n"
  1600. +                     "End with a line saying just \"end\"
  1601. +                 
  1602. +                 or
  1603. +                     "Type documentation for \"%s\".\n"
  1604. +                     "End with a line saying just \"end\".\n"
  1605. +                     
  1606. +                 or
  1607. +                      "Command \"%s\" is built-in."
  1608. + */
  1609. +     
  1610. +         error_cmd = FALSE;
  1611. +                 
  1612. +         /* read message from gdb */
  1613. +         
  1614. +         while (1)
  1615. +             if (fgets(s, LINESIZ, dbxfp))
  1616. +                 {
  1617. +                 if (debug)
  1618. +                     fprintf(stderr, "=>%s", s);
  1619. +                 
  1620. +                 if (strstr(s," is built-in."))    /* error for document of built-in command */
  1621. +                     {
  1622. +                     AppendDialogText(s);
  1623. +                     error_cmd = TRUE;
  1624. +                     bell(0);
  1625. +                     break;
  1626. +                     }
  1627. +             
  1628. +                 if (strstr(s,"Redefine command ")
  1629. +                  || strstr(s,"Really redefine built-in command "))
  1630. +                     write_dbx ("y\n");     /* answer to question if any */
  1631. +                 else
  1632. +                     {
  1633. +                     if (strcmp(s,"End with a line saying just \"end\".\n") == NULL)
  1634. +                         break;
  1635. +                     }
  1636. +                 }
  1637. +         
  1638. +         /* write command definition */
  1639. +         
  1640. +         end_found = FALSE;
  1641. +         
  1642. +         while (fgets (s, LINESIZ, fp))
  1643. +             {
  1644. +             if (!error_cmd)
  1645. +                 {
  1646. +                 AppendDialogText(s);
  1647. +                 write_dbx (s);
  1648. +                 }
  1649. +             
  1650. +             if (match(command_pattern, s, C_END) != -1)
  1651. +                 {
  1652. +                 end_found = TRUE;
  1653. +                 break;
  1654. +                 }
  1655. +             }
  1656. +             
  1657. +         if ((!error_cmd) && (!end_found))
  1658. +             {
  1659. +             AppendDialogText("Error : missing \"end\" in file.\n");
  1660. +             bell(0);
  1661. +             write_dbx ("end\n");
  1662. +             }
  1663. +         
  1664. +         return TRUE;
  1665. +         }
  1666. +         
  1667. +     return FALSE;
  1668. + }
  1669. diff -rc2 v1.01/gdb_regex.h v1.03/gdb_regex.h
  1670. *** v1.01/gdb_regex.h    Tue Jan 15 11:19:14 1991
  1671. --- v1.03/gdb_regex.h    Fri Apr 12 10:06:33 1991
  1672. ***************
  1673. *** 102,105 ****
  1674. --- 102,106 ----
  1675.   #define O_EXEC_DISPLAY        18            /* special for filter_display_info  */
  1676.   #define O_READING_SYMBOLS    19            /* special for filter_reading_symbols */
  1677. + #define O_CORE_FILE            20
  1678.   
  1679.   
  1680. ***************
  1681. *** 126,129 ****
  1682. --- 127,134 ----
  1683.   #define C_SOURCE        19
  1684.   #define C_EXEC_FILE        20
  1685. + #define C_CORE_FILE        21
  1686. + #define C_DEFINE        22
  1687. + #define C_DOCUMENT        23
  1688. + #define C_END            24
  1689.   
  1690.   /*--------------------------------------------------------------------------+
  1691. ***************
  1692. *** 306,312 ****
  1693.       },
  1694.       /* up, down */
  1695. !     {"\\(.*\n\\)*\\(#[0-9]+[ ]+\\(0x[^ ]+[ ]+in[ ]+\\)?\\([^ ]+\\).*\n\\)\\(Source file is more recent than executable.\n\\)?\032\032\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n",
  1696.        NULL,
  1697. !      {2, -1, 4, 7, 6, -1}    
  1698.       },
  1699.       /* bell */
  1700. --- 311,317 ----
  1701.       },
  1702.       /* up, down */
  1703. !     {"\\(.*\n\\)*\\(#[0-9]+[ ]+\\(0x[^ ]+[ ]+in[ ]+\\)?\\([^ ]+\\)[^\032]*\\)\032\032\\([^ ]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ ]+\\):0x.+\n",
  1704.        NULL,
  1705. !      {2, -1, 4, 6, 5, -1}    
  1706.       },
  1707.       /* bell */
  1708. ***************
  1709. *** 379,382 ****
  1710. --- 384,392 ----
  1711.        { 2, -1, -1, -1, -1, -1}
  1712.       },
  1713. +     /* core-file */
  1714. +     {"\\(.*\n\\)*\\(Program terminated with signal \\([-]?[0-9]+\\), [^ ]+.*\n\\)\\(.*\n\\)*",
  1715. +     NULL,
  1716. +      {  2, 3, -1, -1, -1, -1}
  1717. +     },
  1718.       NULL 
  1719.   };
  1720. ***************
  1721. *** 386,390 ****
  1722.       To simplify the patterns, I used for example :
  1723.       
  1724. !         "fr[ame]*" instead of "frame\\|fram\\|fra||fr".
  1725.           
  1726.       This will cause 'frmeame' to be accepted. But this is
  1727. --- 396,400 ----
  1728.       To simplify the patterns, I used for example :
  1729.       
  1730. !         "f[rame]*" instead of "frame\\|fram\\|fra||fr".
  1731.           
  1732.       This will cause 'frmeame' to be accepted. But this is
  1733. ***************
  1734. *** 396,400 ****
  1735.       /* run -r - cont - c - next - n - step - s - nexti - ni - stepi - si - return
  1736.       jump - until - u */
  1737. !     {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|nexti\\|stepi\\|ni\\|si\\|ret[urn]*\\|j[ump]*\\|unt[il]*\\|u\\)\\( .*\\)?\n",
  1738.                                               NULL, {-1, -1, -1, -1, -1, -1}},
  1739.       /* break - tbreak */
  1740. --- 406,412 ----
  1741.       /* run -r - cont - c - next - n - step - s - nexti - ni - stepi - si - return
  1742.       jump - until - u */
  1743. !     /* CRL mod 22 4/5/91 GWC - added attach to this list for gdbvx */
  1744. !     
  1745. !     {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|nexti\\|stepi\\|ni\\|si\\|ret[urn]*\\|j[ump]*\\|unt[il]*\\|u\\|at[tach]*\\)\\( .*\\)?\n",
  1746.                                               NULL, {-1, -1, -1, -1, -1, -1}},
  1747.       /* break - tbreak */
  1748. ***************
  1749. *** 405,410 ****
  1750.       /* 'frame' is special case of 'frame n' since it does not change the
  1751.       current frame. Else 'frame n' is like up or down. */
  1752. !     {"[ ]*fr[ame]*[ ]*\n",                    NULL, {-1, -1, -1, -1, -1, -1}},
  1753. !     {"[ ]*\\(up\\|down\\|dow\\|do\\|fr[ame]*\\)\\( .*\\)?\n", 
  1754.                                               NULL, {-1, -1, -1, -1, -1, -1}},
  1755.                                               
  1756. --- 417,423 ----
  1757.       /* 'frame' is special case of 'frame n' since it does not change the
  1758.       current frame. Else 'frame n' is like up or down. */
  1759. !     /* CRL mod 23 4/5/91 GWC - changed fr[ame] to f[rame] */
  1760. !     {"[ ]*f[rame]*[ ]*\n",                    NULL, {-1, -1, -1, -1, -1, -1}},
  1761. !     {"[ ]*\\(up\\|down\\|dow\\|do\\|f[rame]*\\)\\( .*\\)?\n", 
  1762.                                               NULL, {-1, -1, -1, -1, -1, -1}},
  1763.                                               
  1764. ***************
  1765. *** 453,456 ****
  1766. --- 466,480 ----
  1767.       /* exec-file (just used internally) */
  1768.       {"[ ]*exec-file .*\n",                     NULL, {-1, -1, -1, -1, -1, -1}},
  1769. +     /* core-file */
  1770. +     {"[ ]*cor[e-file]*.*\n",                 NULL, {-1, -1, -1, -1, -1, -1}},
  1771. +     /* define */
  1772. +     {"[ ]*def[ine]*[ ]+[^ ]+\n",             NULL, {-1, -1, -1, -1, -1, -1}},
  1773. +     /* document */
  1774. +     {"[ ]*doc[ument]*[ ]+[^ ]+\n",             NULL, {-1, -1, -1, -1, -1, -1}},
  1775. +     /* end of define or document */
  1776. +     {"[ ]*end[ ]*.*",                         NULL, {-1, -1, -1, -1, -1, -1}},
  1777.       NULL
  1778.   };
  1779. diff -rc2 v1.01/global.h v1.03/global.h
  1780. *** v1.01/global.h    Tue Jan 15 11:19:14 1991
  1781. --- v1.03/global.h    Tue Apr  2 09:00:55 1991
  1782. ***************
  1783. *** 64,67 ****
  1784. --- 64,84 ----
  1785.    */
  1786.   
  1787. + #ifdef __GNUC__
  1788. + #define alloca __builtin_alloca
  1789. + #endif
  1790. + #ifndef MAXPATHLEN
  1791. + #define MAXPATHLEN 1024
  1792. + #endif
  1793. + #ifdef SYSV 
  1794. + #define MAX(a,b)    ((a)>(b)?(a):(b))
  1795. + #define MIN(a,b)    ((a)>(b)?(b):(a))
  1796. + #ifdef sco
  1797. + #include <unistd.h>
  1798. + #endif
  1799. + #endif
  1800.   #include "defs.h"
  1801.   
  1802. diff -rc2 v1.01/handler.c v1.03/handler.c
  1803. *** v1.01/handler.c    Tue Jan 15 11:19:14 1991
  1804. --- v1.03/handler.c    Wed Apr  3 14:13:41 1991
  1805. ***************
  1806. *** 173,177 ****
  1807.       if (Token.func == NULL || Token.line == 0) 
  1808.       return; 
  1809. !     UpdateMessageWindow(Token.mesg);
  1810.       line = Token.line;
  1811.       func = XtNewString(Token.func);
  1812. --- 173,177 ----
  1813.       if (Token.func == NULL || Token.line == 0) 
  1814.       return; 
  1815. !     UpdateMessageWindow(Token.mesg,NULL);
  1816.       line = Token.line;
  1817.       func = XtNewString(Token.func);
  1818. ***************
  1819. *** 219,223 ****
  1820.       UpdateArrow(displayedFile);
  1821.       UpdateUpdown(displayedFile);
  1822. !     UpdateMessageWindow("Ready for execution");
  1823.       if (displayedFile == NULL) return;
  1824.   #ifdef MIPS
  1825. --- 219,223 ----
  1826.       UpdateArrow(displayedFile);
  1827.       UpdateUpdown(displayedFile);
  1828. !     UpdateMessageWindow("Ready for execution",NULL);
  1829.       if (displayedFile == NULL) return;
  1830.   #ifdef MIPS
  1831. ***************
  1832. *** 439,443 ****
  1833.       ClearStops();
  1834.       UpdateStops(displayedFile);
  1835. !         UpdateMessageWindow("Ready for execution");
  1836.       query_dbx("func main\n");
  1837.   #ifndef BSD
  1838. --- 439,443 ----
  1839.       ClearStops();
  1840.       UpdateStops(displayedFile);
  1841. !         UpdateMessageWindow("Ready for execution",NULL);
  1842.       query_dbx("func main\n");
  1843.   #ifndef BSD
  1844. diff -rc2 v1.01/regex.c v1.03/regex.c
  1845. *** v1.01/regex.c    Tue Jan 15 11:19:19 1991
  1846. --- v1.03/regex.c    Tue Apr  2 08:58:56 1991
  1847. ***************
  1848. *** 119,122 ****
  1849. --- 119,126 ----
  1850.   #define FAILURE_STACK   20000           /* max failure stack size */
  1851.   
  1852. + #ifdef __GNUC__
  1853. + #define alloca __builtin_alloca
  1854. + #endif
  1855.   #ifdef emacs
  1856.   
  1857. diff -rc2 v1.01/signals.c v1.03/signals.c
  1858. *** v1.01/signals.c    Tue Jan 15 11:19:20 1991
  1859. --- v1.03/signals.c    Tue Apr  2 08:59:04 1991
  1860. ***************
  1861. *** 73,77 ****
  1862. --- 73,81 ----
  1863.   static void quit_handler()
  1864.   {
  1865. + #ifdef SYSV 
  1866. +     int status;
  1867. + #else
  1868.       union wait status;
  1869. + #endif /* SYSV */
  1870.   
  1871.       /*  wait for the child to report its status; if the child has died, 
  1872. ***************
  1873. *** 78,82 ****
  1874. --- 82,91 ----
  1875.        *  exit gracefully.
  1876.        */
  1877. + #ifdef SYSV 
  1878. +     waitpid(&status, NULL , WNOHANG|WUNTRACED);
  1879. + #else
  1880.       wait3(&status, WNOHANG|WUNTRACED, NULL);
  1881. + #endif /* SYSV */
  1882.       if ((WIFEXITED(status) || WIFSIGNALED(status)) && !WIFSTOPPED(status)) {
  1883.           exit(1);
  1884. diff -rc2 v1.01/source.c v1.03/source.c
  1885. *** v1.01/source.c    Tue Jan 15 11:19:20 1991
  1886. --- v1.03/source.c    Thu Apr 11 14:33:58 1991
  1887. ***************
  1888. *** 79,82 ****
  1889. --- 79,92 ----
  1890.   #include "global.h"
  1891.   
  1892. + #ifdef SYSV 
  1893. + #ifdef sco
  1894. + #   include <fcntl.h>
  1895. + #endif
  1896. + #endif /* SYSV */
  1897. + #ifdef GDB
  1898. + #include <string.h>
  1899. + #endif
  1900.   #define    MAXDIRS    256            /* max number of dirs in dirList */
  1901.   
  1902. ***************
  1903. *** 575,579 ****
  1904. --- 585,593 ----
  1905.   
  1906.               ++i;
  1907. + #ifdef GDB    /* GDB uses ':' as separator character */
  1908. +             s = (char *) strtok(NULL, ": \n");
  1909. + #else
  1910.               s = (char *) strtok(NULL, " \n");
  1911. + #endif /* GDB */
  1912.           }
  1913.           dirList[i] = NULL;
  1914. ***************
  1915. *** 623,626 ****
  1916. --- 637,655 ----
  1917.       else
  1918.            sprintf(pathname, "%s/%s/%s", cwd, dirList[i], filename);
  1919. +          
  1920. + #ifdef GDB    /* (PW)11APR91 : replace all "/./" in pathname by "/".
  1921. +                 because sometimes gdb could produce "./filename",
  1922. +                 eg, when a C file is included in another C file. */
  1923. +     {
  1924. +     char *s;        
  1925. +     char *s2;        
  1926. +     while (s = strstr ( pathname, "/./" ))
  1927. +         {
  1928. +         s++;                                    /* replace "/./" by "/" */
  1929. +         s2 = s + sizeof("/./") - sizeof("/");
  1930. +         while ( *(s++) = *(s2++) );
  1931. +         }
  1932. +     }
  1933. + #endif /* GDB */
  1934.       if (access(pathname, R_OK) == 0)
  1935.           return XtNewString(pathname);
  1936. diff -rc2 v1.01/windows.c v1.03/windows.c
  1937. *** v1.01/windows.c    Tue Jan 15 11:19:21 1991
  1938. --- v1.03/windows.c    Wed Apr  3 15:54:34 1991
  1939. ***************
  1940. *** 27,30 ****
  1941. --- 27,58 ----
  1942.    *  Created:       March 10, 1989
  1943.    *
  1944. +  *****************************************************************************
  1945. +  * 
  1946. +  *  xxgdb - X Window System interface to the gdb debugger
  1947. +  *  
  1948. +  *     Copyright 1990 Thomson Consumer Electronics, Inc.
  1949. +  *  
  1950. +  *  Permission to use, copy, modify, and distribute this software and its
  1951. +  *  documentation for any purpose and without fee is hereby granted,
  1952. +  *  provided that the above copyright notice appear in all copies and that
  1953. +  *  both that copyright notice and this permission notice appear in
  1954. +  *  supporting documentation, and that the name of Thomson Consumer
  1955. +  *  Electronics (TCE) not be used in advertising or publicity pertaining
  1956. +  *  to distribution of the software without specific, written prior
  1957. +  *  permission.  TCE makes no representations about the suitability of
  1958. +  *  this software for any purpose.  It is provided "as is" without express
  1959. +  *  or implied warranty.
  1960. +  *
  1961. +  *  TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1962. +  *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
  1963. +  *  SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
  1964. +  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1965. +  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1966. +  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1967. +  *  SOFTWARE.
  1968. +  *
  1969. +  *  Adaptation to GDB:  Pierre Willard
  1970. +  *  XXGDB Created:       December, 1990
  1971. +  *
  1972.    *****************************************************************************/
  1973.   
  1974. ***************
  1975. *** 160,166 ****
  1976. --- 188,198 ----
  1977.       CreateCommandPanel(vpane);
  1978.       CreateDialogWindow(vpane);
  1979. + #ifdef GDB
  1980. +     CreateDisplayWindow(vpane);
  1981. + #else
  1982.   #ifndef BSD
  1983.       CreateDisplayWindow(vpane);
  1984.   #endif
  1985. + #endif    /* not GDB */
  1986.   } 
  1987.   
  1988. ***************
  1989. *** 197,213 ****
  1990.   }
  1991.   
  1992.   void UpdateMessageWindow(format, arg)
  1993.   char *format, *arg;
  1994.   {
  1995. !     char     message[LINESIZ], string[LINESIZ];
  1996.       Arg     args[MAXARGS];
  1997.       Cardinal     n;
  1998.   
  1999.       strcpy(message, "  ");
  2000. !     sprintf(string, format, arg);
  2001. !     strcat(message, string);
  2002.       n = 0;
  2003.       XtSetArg(args[n], XtNlabel, (XtArgVal) message);        n++;
  2004.       XtSetValues(messageWindow, args, n);
  2005.   }
  2006.   
  2007. --- 229,265 ----
  2008.   }
  2009.   
  2010. + /*--------------------------------------------------------------------------+
  2011. + |                                                                            |
  2012. + |    Note : UpdateMessageWindow assumes that the format string                |
  2013. + |            can only contain one %s specifier.                                |
  2014. + |        arg is either NULL or is a string.                                    |
  2015. + |        format is a string (never NULL).                                    |
  2016. + |                                                                            |
  2017. + +--------------------------------------------------------------------------*/
  2018.   void UpdateMessageWindow(format, arg)
  2019.   char *format, *arg;
  2020.   {
  2021. !     char *message;
  2022. !     char string[LINESIZ];
  2023. !     int fulllength;
  2024.       Arg     args[MAXARGS];
  2025.       Cardinal     n;
  2026.   
  2027. +     fulllength = strlen ("  ") + strlen (format) + 1 + (arg == NULL) ? 0 : strlen (arg);
  2028. +     
  2029. +     if (fulllength > LINESIZ)
  2030. +         message = (char*) XtMalloc (fulllength);
  2031. +     else
  2032. +         message = string;
  2033. +         
  2034.       strcpy(message, "  ");
  2035. !     sprintf(message + strlen(message), format, arg);
  2036. !     
  2037.       n = 0;
  2038.       XtSetArg(args[n], XtNlabel, (XtArgVal) message);        n++;
  2039.       XtSetValues(messageWindow, args, n);
  2040. +     
  2041. +     if (fulllength > LINESIZ)
  2042. +         XtFree(message);
  2043.   }
  2044.   
  2045. diff -rc2 v1.01/xdbx.c v1.03/xdbx.c
  2046. *** v1.01/xdbx.c    Tue Jan 15 11:19:22 1991
  2047. --- v1.03/xdbx.c    Tue Apr 16 10:22:40 1991
  2048. ***************
  2049. *** 72,78 ****
  2050.   
  2051.   #ifdef GDB
  2052. ! #define XGDBVERSION    "1.01"
  2053.   #endif
  2054.   
  2055.   #include "global.h"
  2056.   #include "bitmaps.h"
  2057. --- 72,83 ----
  2058.   
  2059.   #ifdef GDB
  2060. ! #define XGDBVERSION    "1.03"
  2061.   #endif
  2062.   
  2063. + #ifdef SYSV 
  2064. + #   include <stdio.h>
  2065. + #   include <sys/param.h>
  2066. + #endif
  2067.   #include "global.h"
  2068.   #include "bitmaps.h"
  2069. ***************
  2070. *** 82,85 ****
  2071. --- 87,91 ----
  2072.   #define Offset(field) (XtOffset(XdbxResources *, field))
  2073.   
  2074. + char            cwd[MAXPATHLEN];        /* The current working directory */
  2075.   XtAppContext      app_context;         /* application context */
  2076.   Widget      toplevel;         /* top level widget */
  2077. ***************
  2078. *** 99,102 ****
  2079. --- 105,115 ----
  2080.       {"prompt", "Prompt", XtRString, sizeof(char *), 
  2081.       Offset(prompt), XtRImmediate, (caddr_t)NULL},
  2082. +     
  2083. + /* CRL mod 4 3/15/91 GWC - added two new application resources */
  2084. +     {"db_name", "Prompt", XtRString, sizeof(char *), 
  2085. +     Offset(db_name), XtRImmediate, (caddr_t)NULL},
  2086. +     {"db_prompt", "Prompt", XtRString, sizeof(char *), 
  2087. +     Offset(db_prompt), XtRImmediate, (caddr_t)NULL},
  2088.       {"delimiters", "Delimiters", XtRString, sizeof(char *), 
  2089.       Offset(delimiters), XtRImmediate, (caddr_t)NULL},
  2090. ***************
  2091. *** 184,187 ****
  2092. --- 197,205 ----
  2093.       {"-bigicon","bigicon",    XrmoptionNoArg, "True"},
  2094.       {"-debug",    "debug",    XrmoptionNoArg, "True"},
  2095. + /* CRL mod 4 4/1/91 GWC - command line options for db_name and db_prompt */
  2096. +     {"-db_name","db_name",      XrmoptionSepArg, NULL},
  2097. +     {"-db_prompt","db_prompt",  XrmoptionSepArg, NULL},
  2098.   #ifdef GDB
  2099.       {"-d",    "includeDir",    XrmoptionSepArg, NULL},
  2100. ***************
  2101. *** 199,206 ****
  2102.       {"-sr",    "tstartup",    XrmoptionSepArg, NULL},
  2103.   #endif
  2104. - #endif    /* GDB */
  2105.   #ifdef MIPS  /* Mips dbx */
  2106.       {"-pixie",  "pixie",    XrmoptionNoArg, "True"},
  2107.   #endif
  2108.   };
  2109.   
  2110. --- 217,224 ----
  2111.       {"-sr",    "tstartup",    XrmoptionSepArg, NULL},
  2112.   #endif
  2113.   #ifdef MIPS  /* Mips dbx */
  2114.       {"-pixie",  "pixie",    XrmoptionNoArg, "True"},
  2115.   #endif
  2116. + #endif    /* not GDB */
  2117.   };
  2118.   
  2119. ***************
  2120. *** 224,228 ****
  2121.   #else
  2122.           "Usage: %s [-toolkitoptions] [-dbxoptions] [objfile [corefile]]\n",
  2123. ! #endif    /* GDB */
  2124.           call);
  2125.       exit(1);
  2126. --- 242,246 ----
  2127.   #else
  2128.           "Usage: %s [-toolkitoptions] [-dbxoptions] [objfile [corefile]]\n",
  2129. ! #endif    /* not GDB */
  2130.           call);
  2131.       exit(1);
  2132. ***************
  2133. *** 250,254 ****
  2134.       XStoreName(display, XtWindow(toplevel), title);
  2135.       XSetIconName(display, XtWindow(toplevel), "xdbx");
  2136. ! #endif    /* GDB */
  2137.       wmhints.input = True;
  2138.       if (app_resources.bigicon)
  2139. --- 268,272 ----
  2140.       XStoreName(display, XtWindow(toplevel), title);
  2141.       XSetIconName(display, XtWindow(toplevel), "xdbx");
  2142. ! #endif    /* not GDB */
  2143.       wmhints.input = True;
  2144.       if (app_resources.bigicon)
  2145. ***************
  2146. *** 279,283 ****
  2147.       if (access(xdbxinit, R_OK) == -1) {
  2148.           sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), ".dbxinit");
  2149. ! #endif    /* GDB */
  2150.           if (access(xdbxinit, R_OK) == -1) {
  2151.           strcpy(xdbxinit, "");
  2152. --- 297,301 ----
  2153.       if (access(xdbxinit, R_OK) == -1) {
  2154.           sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), ".dbxinit");
  2155. ! #endif    /* not GDB */
  2156.           if (access(xdbxinit, R_OK) == -1) {
  2157.           strcpy(xdbxinit, "");
  2158. ***************
  2159. *** 299,305 ****
  2160.   {
  2161.       char **dbxargv;
  2162. ! #ifdef GDB
  2163. !     char *temp = "xxgdb.XXXXXX";
  2164. ! #else
  2165.       char *temp = "xdbx.XXXXXX";
  2166.   #endif
  2167. --- 317,321 ----
  2168.   {
  2169.       char **dbxargv;
  2170. ! #ifndef GDB
  2171.       char *temp = "xdbx.XXXXXX";
  2172.   #endif
  2173. ***************
  2174. *** 320,327 ****
  2175.       if (app_resources->includeDir) {
  2176.   #ifdef GDB
  2177. !     dbxargv[i++] = "-d ";
  2178.   #else
  2179.       dbxargv[i++] = "-I";
  2180. ! #endif    /* GDB */
  2181.       dbxargv[i++] = app_resources->includeDir;
  2182.       }
  2183. --- 336,343 ----
  2184.       if (app_resources->includeDir) {
  2185.   #ifdef GDB
  2186. !     dbxargv[i++] = "-d";
  2187.   #else
  2188.       dbxargv[i++] = "-I";
  2189. ! #endif    /* not GDB */
  2190.       dbxargv[i++] = app_resources->includeDir;
  2191.       }
  2192. ***************
  2193. *** 356,360 ****
  2194.   #endif
  2195.       dbxargv[i++] = (char *) mktemp(temp);
  2196. ! #endif    /* GDB */
  2197.       }
  2198.       if (app_resources->startup) {    /* overwrites dbxinit */
  2199. --- 372,376 ----
  2200.   #endif
  2201.       dbxargv[i++] = (char *) mktemp(temp);
  2202. ! #endif    /* not GDB */
  2203.       }
  2204.       if (app_resources->startup) {    /* overwrites dbxinit */
  2205. ***************
  2206. *** 366,369 ****
  2207. --- 382,386 ----
  2208.       strcpy(xdbxinit, app_resources->tstartup);
  2209.       }
  2210. + #ifndef GDB
  2211.   #ifdef MIPS
  2212.       if (app_resources->pixie) {        /* pixie output */
  2213. ***************
  2214. *** 371,374 ****
  2215. --- 388,392 ----
  2216.       }
  2217.   #endif
  2218. + #endif    /* not GDB */
  2219.       dbxargv[i] = NULL;
  2220.       *argc = i;
  2221. ***************
  2222. *** 382,385 ****
  2223. --- 400,406 ----
  2224.       char     **dbxargv;
  2225.   
  2226. + #ifdef SYSV 
  2227. +     getcwd((char *)cwd, MAXPATHLEN);
  2228. + #endif
  2229.       trap_signals();
  2230.   
  2231.  
  2232. --
  2233. Dan Heller
  2234. O'Reilly && Associates       Z-Code Software    Comp-sources-x:
  2235. Senior Writer                President          comp-sources.x@uunet.uu.net
  2236. argv@ora.com                 argv@zipcode.com
  2237.